package com.ssy.lingxi.transaction.controller.applet;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.dataauth.annotation.common.DataAuth;
import com.ssy.lingxi.dataauth.model.constant.DataAuthType;
import com.ssy.lingxi.transaction.api.dto.request.AppletInquiryDetailsRequest;
import com.ssy.lingxi.transaction.api.dto.request.AppletInquiryListRequest;
import com.ssy.lingxi.transaction.api.dto.request.InquiryListDetailsRequest;
import com.ssy.lingxi.transaction.api.dto.response.AppletInquiryDetailsResponse;
import com.ssy.lingxi.transaction.api.dto.response.AppletQuoteListResponse;
import com.ssy.lingxi.transaction.api.dto.response.InquiryListDetailsResponse;
import com.ssy.lingxi.transaction.service.IInquiryService;
import com.ssy.lingxi.transaction.service.IQuoteService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author xiaomai
 * @Description 小程序业务员询价单
 * @Date 2022/3/23 11:06
* @menu 小程序业务员询价单
 **/
@RestController
@RequestMapping("/transaction/applet")
public class AppletInquiryController extends BaseController {

    @Resource
    private IInquiryService inquiryService;

    /**
     * 询价报价-询价单查询
     */
    @GetMapping("/product/inquiry/list")
//    @DataAuth(tableName = "trade_inquiry", memberIdColumnName = "member_id", roleIdColumnName = "member_role_id", userIdColumnName = "user_id", type = DataAuthType.CHANNEL)
    public Wrapper<PageData<AppletQuoteListResponse>> appletInquiryList(AppletInquiryListRequest request, HttpServletRequest httpServletRequest) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return inquiryService.appletInquiryList(request, sysUser);
    }

    /**
     *询价报价-询价单详情
     */
    @GetMapping("/product/inquiry/details")
    public Wrapper<AppletInquiryDetailsResponse> appletInquiryDetails(AppletInquiryDetailsRequest request, HttpServletRequest httpServletRequest) {
        UserLoginCacheDTO sysUser = this.getSysUser(httpServletRequest);
        return inquiryService.appletInquiryDetails(request,sysUser);
    }

}
